""" DigitalICS: mobile data collection tool to complete surveys with integrated multimedia

    Copyright (C) 2009. Yael Schwartzman  

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>
    
    Contact information: Yael Schwartzman -  yaelsf@gmail.com
    """
from api.form import Form
from api.constants import Constants



def enform2(community,municipio,localidad,producer):
    c = Constants()
    form = Form()
    form.set_community_id(community)
    form.set_producer_id(producer)
    form.set_municipio_id(municipio)
    form.set_localidad_id(localidad)
        
    form.set_id("Section2")
    form.set_name("Follow Up")
    form.set_module("enform2")
    
    
    form.add_mult_data(['attended_recommendations', "write_or_record",'description','description_recorded',
                        "ts1","ts2"])
    
    form.add_prompt(label = "1. Did the producer attend to the recomendations established by last year's  evaluation comittee ?",
                    audio = "2.1attended",
                    input_type = c.SELECT1,
                    options = ['YES','NO','NEW MEMBER'],
                    id = '1.attended',
                    data = 'attended_recommendations',
                    output = {'YES':"1. THE PRODUCER DID TEND TO LAST YEAR'S EVALUATION COMITTEE RECOMENDATIONS",
                              'NO': "1. THE PRODUCER DID NOT TEND TO LAST YEAR'S EVALUATION COMITTEE RECOMENDATIONS",
                              'NEW MEMBER': '1. THE PRODUCER DID NOT HAVE RECOMMENDATIONS BECAUSE HE IS A NEW MEMBER'},
                    breach = ['NO'])
    
    form.add_prompt(relevance = {'1.attended': '!= "NEW MEMBER"'},
                    label = "2. Do you wish to write or record the recommendations that were followed",
                    id = "2.record/write",
                    input_type =c.SELECT1,
                    options = ['Record' ,'Write'],
                    data = "write_or_record",
                    audio = "record_write")
    
    form.add_prompt(relevance = {'2.record/write':" =='Write' " },
                    label = "3. Please describe what the producer did to comply with last year's recommendations",
                    audio = "2.2actions",
                    id = '3.description',
                    data = 'description',
                    output= "2. GROWING PRACTICES DONE TO COMPLY WITH LAST YEAR'S RECOMMENDATIONS",
                    input_type = c.INPUT,
                    return_type = c.RETURN_STRING) 
    
    form.add_prompt(relevance = {'2.record/write':" =='Record' " },
                    label = "3. Please describe what the producer did to comply with last year's recommendations",
                    audio = "2.2actions",
                    id = '3.recording',
                    data = 'description_recorded',
                    output= "3. GROWING PRACTICES DONE TO COMPLY WITH LAST YEAR'S RECOMMENDATIONS  #VAR",
                    input_type = c.AUDIO,
                    media_file = 'description_acciones.amr')
     
    
    return form
